package com.zhq.test;

import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.*;

public class eee {

    public static void main(String[] args) {
        Random random = new Random();
        LocalDateTime localDateTime = LocalDateTime.now().plusSeconds(random.nextInt(300) + 10);
        Long second = localDateTime.toEpochSecond(ZoneOffset.of("+8"));
        System.out.println("jajja" + second);
        Map<Long, String> map = new HashMap<>();
        map.put(second, 123 + "," + 45);
        sendDelay(map);
    }
    /**
     * 短信延时发送
     */
    public static void sendDelay(Map<Long, String> map) {
        // System.out.println("hahah ");
        LocalDateTime localDateTime = LocalDateTime.now();
        Long second = localDateTime.minusMinutes(1).toEpochSecond(ZoneOffset.of("+8"));
        // System.out.println("kkk" + second);
        long l = localDateTime.plusMinutes(8).toEpochSecond(ZoneOffset.of("+8"));
        // System.out.println("lala" + l);
        for (Long i = second; i < l; i++) {
            // System.out.println("所有的i" + i);
            if (map.containsKey(i)) {
                // System.out.println("hahahh"); //1598083690  1598083690
                //录入成功
                String phoneAndCode = map.get(i);
                // System.out.println(phoneAndCode);
                if (phoneAndCode != null) {
                    String[] split = phoneAndCode.split(",");
                    if (split[0] != null && split[1] != null) {
                        // System.out.println(split[0] + "," + split[1]);
                    }
                }

            }
        }
    }

}

